#pragma once

#include <common.h>
#include <ir/block.h>
#include <ir/array_info.h>
#include <ir/global_reg.h>
#include <ir/inst.h>

namespace riscv {
  class Visitor;
}

namespace ir {
  class Func;
  class Block;
  class InstGlobalAlloc;
}

namespace ir {

  class CompUnit {
  public:
    std::vector<GlobalReg*> global_reg_list;
    std::vector<Func*> func_list;
    std::vector<InstGlobalAlloc*> inst_global_alloc_list;

    ~CompUnit();
  };

  class Func {
  public:
    std::string name;
    VarType func_type;
    std::vector<Reg*> arg_list;
    std::vector<Block*> block_list;
    std::vector<ArrayInfo*> array_info_list;

    void accept(riscv::Visitor & visitor);

    std::string get_name();

    ~Func();
  };
}
